home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
016a
/
drivex0.zip
/
DRVDEMO.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1991-11-01
|
10KB
|
266 lines
(******************************************************************************)
(* PROGRAM DRVDEMO *)
(* *)
(* Version: 1.01 *)
(* *)
(* Copyright (C) 1991 by NativSoft Computing *)
(* *)
(* 1155 College Ave *)
(* Adrian, MI 49221 *)
(* (517) 265-6080 *)
(* CIS [71160,1045] *)
(* *)
(* ALL RIGHTS RESERVED *)
(******************************************************************************)
(******************************************************************************)
(* Written by: Charles B. Little, Ph.D. *)
(* Version: 1.01 *)
(* Revision Date: 1 November 1991 *)
(* Purpose: To demonstrate the use of unit DRIVExx to obtain *)
(* important information about disk drives. *)
(******************************************************************************)
{$S-,R-}
PROGRAM DRVDEMO;
USES DOS, CRT, DRIVExx;
function cursorline : byte;
var regs : registers;
begin
regs.ax := $0F00; {puts display page in regs.bh, necessary for next call}
Intr($10,regs);
regs.ax := $0300;
Intr($10,regs);
cursorline := regs.dh + 1;
end;
var index : char;
X : longint;
DP : fakeDPB;
{******************************************************************************}
{ ALWAYS CHECK THE GLOBAL ERROR VARIABLE 'DriveError' AT THE BEGINNING OF ANY }
{ PROGRAM THAT USES THE DRIVExx UNIT, AND AGAIN AFTER EACH CALL TO }
{ 'UpdateDrives' DURING PROGRAM EXECUTION! }
{ }
{ IF DriveError IS NON-ZERO, YOU MAY CALL THE PROCEDURE ShowDriveError to HELP }
{ INTERPRET THE ERROR, OR YOU MAY HANDLE THE SITUATION ANY WAY YOU LIKE. }
{ A NON-ZERO DriveError DOES NOT MEAN A FATAL ERROR, JUST THAT YOU WON'T BE }
{ ABLE TO DEPEND ON ANY INFORMATION YOU GET FROM ANY DRIVExx UNIT FUNCTION TO }
{ BE CORRECT OR ACCURATE. }
{ }
{ THERE ARE ONLY THREE TYPES OF ERRORS THAT WILL RESULT IN IMMEDIATE EXIT FROM }
{ UpdateDrives: WRONG DOS VERSION (OR OS/2), FAILURE TO FIND THE ADDRESS OF }
{ THE LIST-OF-LISTS, AND NOT ENOUGH MEMORY TO CREATE THE VARIABLE DRIVES^. }
{ ALL OF THESE ERRORS WILL RESULT IN ALL BOOLEANS SET TO FALSE AND ALL STRINGS }
{ SET TO NULL, BECAUSE THEY MAKE IT IMPOSSIBLE TO CONTINUE PROCESSING. }
{******************************************************************************}
BEGIN
clrscr;
if DriveError <> 0 then ShowDriveError;
textcolor(white);
writeln('DRVDEMO - DRIVExx Unit Demo Program, Copyright (C) 1991 by NativSoft Computing');
textcolor(lightgray);
window(1,2,80,25);
writeln;
write( 'Operating System..............................: ');
if DRDOS then write('DR DOS') else write('MS DOS');
writeln(' version ',DOSVER:4:2);
writeln('BIOS Date.....................................: ',BiosDateString);
write( 'Processor Type................................: ');
case ProcessorType of
1 : writeln('8088/8086');
2 : writeln('80286');
3 : writeln('80386');
-3 : writeln('80386SX');
4 : writeln('80486');
else writeln('Unknown (',ProcessorType,')');
end; {case}
writeln;
writeln('Valid Logical Drives..........................: ',alllogicaldrives);
if DevDrvrChainValid then
writeln('Bootable Drives...............................: ',bootabledrives);
writeln('Number of BIOS-driven Internal Floppies.......: ',Internalfloppies);
writeln('Valid Floppy Drives...........................: ',floppies);
writeln('Valid Hard Disk Partitions....................: ',hards);
writeln('Current default drive and path................: ',CurrentDir(defaultdrive));
writeln;
gotoxy(1,24);
textcolor(white);
write('Press ENTER to see individual drive characteristics ...');
textcolor(lightgray);
readln;
clrscr;
for index := 'A' to 'Z' do
begin
if cursorline >= 21 then
begin
gotoxy(1,24);
write('==> Press ENTER to continue ');
readln;
clrscr;
writeln;
end;
if DrivExists(index) then
begin
writeln;
writeln(index,':');
if DriveisNormal(index) then
begin
write('normal:');
if DriveisRemovable(index) then
begin
write(' removable');
case RemovableDrivetype(index) of
-3,-2,-1 : write(', Drivetype error ',RemovableDrivetype(index));
1 : write(', 5.25" DD');
2 : write(', 5.25" HD');
3 : write(', 3.5" DD');
4 : write(', 3.5" HD');
5 : write(', 3.5" QD');
6 : write(', Tape');
7 : write(', Bernoulli');
else write(', type = ?');
end; {case}
if ChangeLineSupported(index) then
begin
if DiskWasChanged(index) then write(', changed')
else write(', not changed');
end;
end
else
begin
if DriveisHard(index) then write(' hard');
if DriveisRAMDisk(index) then write(' RAMDisk');
if DriveisOtherfixed(index) then write(' unknown fixed');
end;
{can't use LONGINT variables as selectors in case statements, so we
must handle DriveSize in a less than elegant way}
X := DriveSize(index);
if (X = -1) then write(', size = error')
else
if (X = 0) then write(', size = ?')
else
write(', size = ',X);
end
else
begin
write('abnormal:');
if DriveisPhantom(index) then
write(' phantom, mapped to ',DriveMappedTo(index),':');
if DriveisNONDOS(index) then write(' NON-DOS');
if DriveisAliased(index) then
begin
if DRDOS then write(' aliased')
{ DRDOS reports SUBST when *either* ASSIGN or SUBST is used. Since
we cannot verify that NETWORK and IFS will be reported correctly
under DRDOS, we recommend that the generic "aliased" be used to
classify ALL of these situations below when running under that OS }
else
begin
if DriveisJoined(index) then write(' joined');
if DriveisSubsted(index) then write(' substituted');
if DriveisAssigned(index) then write(' assigned');
if DriveisNetwork(index) then write(' network');
if DriveisIFS(index) then write(' IFS');
end;
end;
end;
{the following apply to all drives, normal or abnormal}
if DevDrvrChainValid then
begin
if DriveisDeviceDriven(index) then write(', device driven');
if DriveisSwapped(index) then write(', swapped');
end;
writeln;
writeln('Logged Directory is ',CurrentDir(index));
end;
end; {for index := 'A' to 'Z' do}
writeln;
writeln;
write('Enter a drive letter to demonstrate function GETDPB ');
readln(index);
index := upcase(index);
if pos(index, AllLogicalDrives) = 0 then halt;
clrscr;
if GETDPB(index,DP,false) then {FALSE means don't hit the disk}
begin
writeln;
writeln('Drive ',index,': DPB data in memory');
writeln;
with DP do
begin
writeln('Unit number within device driver : ',ddunitnum);
writeln(' Bytes per Sector : ',bytespersex);
writeln(' Sectors per Cluster : ',sexperclust);
writeln(' Number of FATs : ',numFATS);
writeln('Number of root directory entries : ',RootdirEnts);
writeln(' First data sector on disk : ',FirstDataSec);
writeln(' Number of data clusters on disk : ',numclusts);
writeln(' Sectors per FAT : ',sexperFAT);
writeln(' Sectors per root directory : ',RootdirSex);
writeln(' Media descriptor byte : ',mediabyte);
write (' Access flag : ',accessflag);
if accessflag <> 0 then writeln(' (NOT ACCESSED SINCE BOOTUP)')
else writeln;
end;
end;
writeln;
writeln;
write('Press ENTER to get *NEW* DPB data');
readln;
clrscr;
if GETDPB(index,DP,true) then {TRUE means hit the disk}
begin
writeln;
writeln('Drive ',index,': DPB data from direct disk access');
writeln;
with DP do
begin
writeln('Unit number within device driver : ',ddunitnum);
writeln(' Bytes per Sector : ',bytespersex);
writeln(' Sectors per Cluster : ',sexperclust);
writeln(' Number of FATs : ',numFATS);
writeln('Number of root directory entries : ',RootdirEnts);
writeln(' First data sector on disk : ',FirstDataSec);
writeln(' Number of data clusters on disk : ',numclusts);
writeln(' Sectors per FAT : ',sexperFAT);
writeln(' Sectors per root directory : ',RootdirSex);
writeln(' Media descriptor byte : ',mediabyte);
writeln(' Access flag : ',accessflag);
end;
end
else
begin
writeln;
writeln('Drive ',index,': probably not ready');
end;
writeln;
writeln;
write('Press ENTER to quit demo');
readln;
clrscr;
END.